package com.dream.wuliu.utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;


public class MyUtils {


	public static boolean isBlank(String str) {
		
		return str == null || str.isEmpty();
	}
	
	public static boolean isNotBlank(String str) {
		return !isBlank(str);
	}

	public static String trim(String input) {
		return MyUtils.isBlank(input) ? "" : input.trim();
	}

	public static boolean isEmpty(Object[] ors) {
		return ors == null || ors.length == 0 ;
	}

	public static boolean isNotEmpty(Object[] ors) {
		return !isEmpty(ors);
	}

	public static <T> ArrayList<T> newArrayList() {

		return new ArrayList<T>();
	}

	public static <T> List<T> newArrayList(T... ts) {

		List<T> as = new ArrayList<T>();
		if (MyUtils.isNotEmpty(ts)) {
			for (T si : ts) {
				as.add(si);
			}
		}

		return as;
	}

	public static <K, V> HashMap<K, V> newHashMap() {

		return new HashMap<K, V>();
	}

	public static <E> HashSet<E> newHashSet() {

		return new HashSet<E>();
	}

	public static <T> boolean isEmpty(Collection<T> c) {

		return (c == null || c.isEmpty());
	}

	public static <T> boolean isNotEmpty(Collection<T> c) {
		return !isEmpty(c);
	}

	public static <K, V> boolean isEmpty(Map<K, V> m) {

		return (m == null || m.isEmpty());
	}

	public static <K, V> boolean isNotEmpty(Map<K, V> m) {

		return !isEmpty(m);
	}

}
